package com.daodway.designpattern.commandpattern.macro;

import java.util.ArrayList;

import org.junit.Test;

public class Client {
	@Test
	public void main() {
		ArrayList<Command> list  = new ArrayList<Command>();
		RequestPerson person = new RequestPerson();
		Command command1= new PrintEnglisCommand(new PrintLetter());
		Command command2= new PrintAuthorCommand(new PrintLetter());
		Command command3= new PrintNumberCommand(new PrintNumber(20));
		list.add(command1);
		list.add(command2);
		list.add(command3);
		Command macroCommand = new MacroCommand(list);
		System.out.print("单独输出一张英文表:");
		person.setCommand(command1);
		person.startExecute();
		System.out.println("%n用一个宏输出英文字母表,作者和1-20的偶数%n");
		person.setCommand(macroCommand);
		person.startExecute();
	}

}
